import App from './App.vue'
import router from './router'
import piniaPersist from 'pinia-plugin-persist'

/**
 * dayjs
 */
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'
dayjs.locale('zh-cn')

/**
 * 样式导入
 */
import 'virtual:svg-icons-register'
import '@/styles/common.scss'
import '@/styles/reset-element-plus.scss'

/**
 * app设置
 */
const pinia = createPinia()
pinia.use(piniaPersist)
const app = createApp(App)
app.use(router)
app.use(pinia)
app.mount('#fpi-app')
// 必须保留，否则子应用的错误，会导致页面崩溃
app.config.errorHandler = (err, vm, info) => {
    console.log(window.__MICRO_APP_NAME__, err, vm, info)
}
// 卸载应用
window.onunmount = () => {
    console.log(window.__MICRO_APP_NAME__, 'app.unmount()')
    app.unmount()
}
